package oop.ex1.orders;
import java.io.*;

import oop.ex1.filescript.BadOrderExeption;

/**
 * an order object that compares the files by its path Name
 * @author danalmog
 * @author danielshalev
 */
public class AbsOrder extends Order {

	/**
	 * compares to files by its path Name
	 * @param o1 the first file to compare
	 * @param o2 the second file to compare
	 */
	@Override
	public int compare(File o1, File o2) throws BadOrderExeption{
		try{
			if(o1.getCanonicalPath().compareTo(o2.getCanonicalPath())==0)
					return 1;
			return (o1.getCanonicalPath().compareTo(o2.getCanonicalPath()));
		}
		catch(IOException e){
			throw new BadOrderExeption();
		}
	}
	
}
